package com.t13;

/**
 * Created by xuyiwei on 2018/7/23.
 */
public class StringFormat {
    public static void main(String[] args) {
        //单个占位符
        String s1 = String.format("1、Hello %s，Welcome to my blog!", "jerry");
        System.out.println(s1);//Hello jerry，Welcome to my blog!
        //多个占位符 按顺序
        String s2 = String.format("2、Hello %s%s%s", "jerry-", "li", ",welcome!");
        System.out.println(s2);//Hello jerry-li,welcome!
        //多个占位符 按索引
        String s3 = String.format("Hello %2$s%3$s%1$s", "li-", "heng-", "jie");
        System.out.println(s3);//Hello jerry-li,welcome!
        //对整数进行格式化
        int n2 = 9999999;
        System.out.printf("%+(,d %n", n2);
        System.out.println("你好/tn");
    }

    private static StringFormat s;
    public void get(){
        StringFormat a = s;
    }
}
